import {
	post,
	get
} from '@/puigins/request.js'

export function addSchedule(form) {
	return post("admin/schedule/addSchedule", form)
}

export function getScheduleList() {
	return get("/admin/schedule/getScheduleList")
}
export function stopSchedule(id) {
	if(isNaN(id)){
		return console.error("isNaN",id)
	}
	return get("/admin/schedule/stopSchedule",{id})
}

export function enableSchedule(id) {
	if(isNaN(id)){
		return console.error("isNaN",id)
	}
	return get("/admin/schedule/enableSchedule",{id})
}

export function getScheduleLogList(page,pageSize,query) {
	return get("/admin/scheduleLog/getScheduleLogList",Object.assign({page,pageSize},query))
}

export function getScheduleLogJobIds() {
	return get("/admin/scheduleLog/getScheduleLogJobIds")
}

export function runOnce(id){
	if(isNaN(id)){
		return console.error("isNaN",id)
	}
	return get("/admin/schedule/runOnce/"+id)
}

export function searchBeanName(beanName){
	return get("/admin/schedule/searchBeanName",{beanName})
}

export function searchBeanMethod(beanName,methodName){
	return get("/admin/schedule/searchBeanMethod",{beanName,methodName})
}